package com.masterclient.app.businessmodule.vipmodule.card;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.masterclient.app.R;
import com.masterclient.app.businessmodule.vipmodule.bean.Order;
import com.masterclient.app.businessmodule.vipmodule.view.OrderView;
import com.masterclient.app.modules.aftersale.LogistInfoActivity;

import butterknife.BindView;


/**
 * 零售订单-待收货
 */
public class OrderDshCard extends IBaseCard<Order> {
    @BindView(R.id.orderViwe)
    OrderView orderViwe;
    @BindView(R.id.btn_tv)
    TextView btnTv;
    private String id;
    private Order.ButtonBean buttonBean;
    public OrderDshCard(View itemView, Context context) {
        super(itemView, context);
    }

    @Override
    public void onBindViewHolder(Order order, int i) {
        orderViwe.setOrder(order);
        buttonBean = order.getButton();
        id = order.getOrder().getId();
        int view_track_btn = buttonBean.getView_track_btn();// 发货
        if(1 == view_track_btn)
            btnTv.setVisibility(View.VISIBLE);
        else btnTv.setVisibility(View.GONE);
        btnTv.setOnClickListener(v -> startLogisActivity());
    }

    /**
     * 跳转到查看物流
     */
    private void startLogisActivity(){
        Bundle bundle = new Bundle();
        bundle.putString("order_id",id);
        bundle.putString("track_no","");
        bundle.putString("biz_type","1");
        bundle.putBoolean("showKefu",false);
        Intent intent = new Intent(mContext, LogistInfoActivity.class);
        intent.putExtras(bundle);
        mContext.startActivity(intent);
    }
}
